<template>
  <div style="text-align: center">
    <h2 :class="{ active: !isActive }">全文检索</h2>
    <el-form :inline="true" :model="dataForm" @keyup.enter="getDataList()">
      <el-form-item prop="generalArchiveList">
        <label :class="{ active: isActive }">检索字段：</label>
        <el-input style="width: 990px" v-model="dataForm.queryField" placeholder="根据检索字段输入值" clearable></el-input>
      </el-form-item>
      <el-form-item prop="generalArchiveList">
        <div style="width: 180px" :class="{ active: isActive }"></div>
      </el-form-item>
      <el-form-item prop="generalArchiveList">
        <el-button type="primary" :class="{ active: isActive }" style="width: 78px" @click="searching()">重置</el-button>
        <el-button type="primary" @click="searching()">检索</el-button>
      </el-form-item>
      <div :class="{ active: isActive }" style="width: 100%; height: 18px; background-color: rgb(240, 242, 245); position: fixed; left: 244px"></div>
    </el-form>
    <div style="text-align: left" :class="{ active: isActive }">
      <div style="margin: 40px 0 15px">
        <el-button type="primary" style="width: 78px" @click="dialogVisible = true">档案鉴定</el-button>
        <el-button type="primary" style="width: 78px">利用申请</el-button>
        <el-button type="primary" style="width: 78px">加入收藏</el-button>
      </div>
      <div>
        <div class="file" v-for="item in dataList" :key="item.id">
          <img src="/img/icon-ocr-identify.png" alt="" />
          <div>
            <p>{{item.title}}</p>
            <span>{{item.content}}</span>
          </div>
        </div>
        <el-pagination style="padding: 0px 38%" :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle" @current-change="pageCurrentChangeHandle"> </el-pagination>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import useView from "@/hooks/useView";
import { defineComponent, reactive, toRefs } from "vue";
import baseService from "@/service/baseService";
export default defineComponent({
  setup() {
    const state = reactive({
      dialogVisible:false,
      activeName: "first",
      isActive: true,
      getDataListURL: "/archive/elastic-search/",
      getDataListIsPage: true,
      deleteIsBatch: true,
      dataForm: {
        queryField: ""
      },
      total:0,
      dataList:[],
    });

    return { ...useView(state), ...toRefs(state) };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },

    searching() {
     this.getDataList()
      this.isActive = !this.isActive;
    },
  }
});
</script>

<style lang="less" scoped>
.el-form {
  margin: 15px 0;
}
/deep/.el-input--small .el-input__inner {
  height: 40px;
  line-height: 40px;
}
/deep/.el-button {
  width: 78px;
}
.active {
  display: none;
}
.file {
  display: flex;
  margin-top: 20px;
  border-top: 2px solid rgb(240, 242, 245);
  img {
    width: 20px;
    height: 20px;
    margin-top: 18px;
  }
  div {
    margin-left: 10px;
    p {
      cursor: pointer;
      font-size: 16px;
      color: rgb(71, 129, 199);
    }
  }
}
</style>
